#include "stc.h"
int a;
int b;
int c;
int d;
int e;
int f;
int run=0;
int trip=0;
int r=1;
int p;

void main()
{
	while(r=1)
	{
		PutStr("xin nhap so co 6 chu so:");
		int number=GetInt();	
		a=number/100000%10;
		b=number/10000%10;
		c=number/1000%10;
		d=number/100%10;
		e=number/10%10;
		f=number/1%10;
		int n[]={a,b,c,d,e,f};
		while(a>b || b>c || c>d || d>e || e>f)
		{
			if(a>b)
			{
				int m=a;
				a=b;
				b=m; 	 
			}
			if(b>c)
			{
				int m=b;
				b=c;
				c=m;
			}
			if (c>d)
			{	
				int m=c;
				c=d;
				d=m; 	  
			}
			if(d>e)
			{
				int m=d;
				d=e;
				e=m;
			}
			if(e>f)
			{
				int m=e;
				e=f;
				f=m;
			}
		}
		
		int i=0;
		while(i<4)
		{
			int j=i+1;
			while(j<5)
			{
				if(n[i]==n[j]) 
				{
					int k=j+1;
					while(k<6)
					{
						if(n[j]==n[k])
						{
							trip=trip+1;
						}
						k=k+1;		 
					}
				}
				j=j+1;
			}
			i=i+1;
		}
		while(i<4)
		{
			int j=i+1;
			while(j<5)
			{
				if(n[j]==n[i]+1) 
				{
					int k=j+1;
					while(k<6)
					{
						if(n[k]==n[j]+1)
						{
							run=run+1;
						}
						k=k+1;	 
					}

				}
				j=j+1;
			}
			i=i+1;
		}
		if(trip==2 || run ==2 || trip==1 && run==1)
		{
			PutStr("\n Bayby Gin !!!");
			PutStr("\n Play the game again? <1=yes/2= no>: ");
			p=GetInt();
			if(p==1)
			{
				r=1;
			}
			else{
				PutStr("done!!!");
				break;
			}
		}
		else
		{ PutStr("\n You Lose!!!");
		PutStr("\n Play the game again? <1=yes/2= no>:");
		p=GetInt();
		if(p==1)
		{
			r=1;
		}
		else{
			PutStr("done!!!");
			break;
		}
		}
	}

}